<{include file ="header.tpl"}>
<{include file ="navibar.tpl"}>
<{include file ="sidebar.tpl"}>
<!-- START 以上内容不需更改，保证该TPL页内的标签匹配即可 -->
<{$osadmin_action_alert}>
<{$osadmin_quick_note}>

<div class="well">
    <ul class="nav nav-tabs">
        <li class="active"><a href="#home" data-toggle="tab">团购店铺基本配置</a></li>
    </ul>

    <div id="myTabContent" class="tab-content">
        <div class="tab-pane active in" id="home">

            <form id="tab" method="post" action="">
                <label>公司名称</label>
                <input type="text" name="company_name" id="company_name" value="<{$_POST.company_name}>"
                       class="input-xlarge"
                       autofocus="true" placeholder="公司全称，不要超过30个字符">
                <label>頁面标题</label>
                <input type="text" name="title" id="title" value="<{$_POST.title}>" class="input-xlarge"
                       autofocus="true">
                <label>頁面关键词</label>
                <input type="text" name="keyword" id="keyword" value="<{$_POST.keyword}>" class="input-xlarge"
                       autofocus="true" placeholder="多个请用半角逗号隔开">
                <label>頁面描述</label>
                <textarea name="desc" rows="3" id="desc" class="input-xlarge"><{$_POST.desc}></textarea>
                <label>統計代碼</label>
                <textarea name="tj_code" id="tj_code" rows="3" class="input-xlarge"><{$_POST.tj_code}></textarea>

                <label>底部版权信息</label>
                <textarea name="copyright" id="copyright" rows="3" class="input-xlarge"><{$_POST.copyright}></textarea>

                <div class="btn-toolbar">
                    <button type="button" class="btn btn-primary" onclick="tijiao()"><strong>提交</strong></button>
                </div>
            </form>
        </div>
    </div>
</div>


<script>
    function htmlEncodeByRegExp(str) {
        var s = "";
        if (str.length == 0) return "";
        s = str.replace(/&/g, "&amp;");
        s = s.replace(/</g, "&lt;");
        s = s.replace(/>/g, "&gt;");
        s = s.replace(/ /g, "&nbsp;");
        s = s.replace(/\'/g, "&#39;");
        s = s.replace(/\"/g, "&quot;");
        return s;
    }


    function tijiao() {
        var c3;
        if ($("#tj_code").val()) {
            c3 = htmlEncodeByRegExp($("#tj_code").val());
        } else {
            c3 = '';
        }

        var title = $("#title").val();
        var company_name = $("#company_name").val();
        var keyword = $("#keyword").val();
        var desc = $("#desc").val();
        var copyright = $("#copyright").val();
        $.ajax({
            url: 'sys_config.php',// 跳转到 action
            data: {
                "title": title,
                "company_name": company_name,
                "keyword": keyword,
                "desc": desc,
                "copyright": copyright,
                "tj_code": c3
            },
            type: 'post',
            cache: false,
            dataType: 'json',
            success: function (ret) {
                if (ret.code == "0") {
                    alert("提交成功");
                    window.location.reload();
                } else {
                    alert("服務器錯誤");
                    return;
                }
            },
            error: function () {
                alert("服務器錯誤！");
            }
        });
    }
</script>


<!-- END 以下内容不需更改，请保证该TPL页内的标签匹配即可 -->
<{include file="footer.tpl" }>